import { ColumnProps } from '~/library/components/ProTable/interface'
import { Procure } from '~/src/api/interface/procure'
import { getLastQuarterDays } from '~/src/utils/date'
import { formatDate } from '~/src/utils/date-formatter'
import { warehouseStatus } from '~/src/utils/serviceDict'

export const adjustmentOrderColumn: ColumnProps<Procure.Rejection[]>[] = [
  {
    type: 'index',
    label: '序号',
    search: {
      el: 'date-picker',
      label: '单据日期',
      key: 'timeValue',
      order: 1,
      defaultValue: [formatDate(-getLastQuarterDays(), 'start', 'yyyy-MM-dd'), formatDate(0, 'end', 'yyyy-MM-dd')],
      props: {
        type: 'datetimerange',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
      },
    },
    width: 60,
  },
  {
    sortable: true,
    prop: 'date',
    label: '调整日期',
    minWidth: 150,
    align: 'center',
  },
  { sortable: true, prop: 'orderNo', label: '单据编号', minWidth: 200, search: { el: 'input' } },
  // {    sortable: true, prop: "", label: "仓库", enum: deliveryStatus, align: "" },
  { sortable: true, prop: 'itemCount', label: '物品（项）', align: 'center', width: 130 },
  { sortable: true, prop: 'amount', label: '金额', align: 'center' },
  {
    sortable: true,
    prop: 'checkFlag',
    label: '单据状态',
    minWidth: 120,
    enum: warehouseStatus,
    align: 'center',
    search: { el: 'select', key: 'checkFlag' },
  },
  // {
  //   sortable: true,
  //   prop: 'sourceNo',
  //   label: '关联单号',
  //   minWidth: 140,
  //   align: 'center',
  // },
  {
    sortable: true,
    prop: 'createTime',
    label: '创建时间',
    minWidth: 164,
    align: 'center',
  },
  { sortable: true, prop: 'remark', label: '备注', minWidth: 180, align: 'center', search: { el: 'input' } },
  { prop: 'operation', label: '操作', width: 180, fixed: 'right' },
]
